//
//  AppDelegate.m
//  JerryIos
//
//  Created by 王军 on 2018/2/1.
//  Copyright © 2018年 王军. All rights reserved.
//

#import "AppDelegate.h"
#import "MainController.h"
#import "WJNavigationController.h"
#import <Bugly/Bugly.h>
#import <IQKeyboardManager/IQKeyboardManager.h>

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    //初使化Bugly
    [self initBugly];
    //初使化KeyboardManager
    [self initKeyboardManager];
    
    // 1.创建窗口
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    
    // 2.设置窗口根控制器
    MainController *mainController = [[MainController alloc] init];
    WJNavigationController *navController = [[WJNavigationController alloc] initWithRootViewController:mainController];
    self.window.rootViewController = navController;
    
    // 3.显示窗口
    [self.window makeKeyAndVisible];

    return YES;
}

-(void)initBugly {
    [Bugly startWithAppId:@"27c72a9feb"];
}

-(void)initKeyboardManager {
    // 获取类库的单例变量
    IQKeyboardManager *keyboardManager = [IQKeyboardManager sharedManager];
    // 项目使用不使用 IQKeyboardManager 这个类库，当然，某些页面可以根据需要单独设置
    keyboardManager.enable = YES;
    // 点击背景是否收起键盘
    keyboardManager.shouldResignOnTouchOutside = YES;
    // 控制键盘上的工具条文字颜色是否用户自定义
    keyboardManager.shouldToolbarUsesTextFieldTintColor = YES;
    // 有多个输入框时，可以通过点击Toolbar 上的“前一个”“后一个”按钮来实现移动到不同的输入框
    keyboardManager.toolbarManageBehaviour = IQAutoToolbarBySubviews;
    // 是否显示键盘上的工具条
    keyboardManager.enableAutoToolbar = YES;
    // 是否显示占位文字（如果输入框有占位文字，那么在 Toolbar 中默认会显示出来）
    keyboardManager.shouldShowTextFieldPlaceholder = YES;
    // 设置占位文字的字体大小
    keyboardManager.placeholderFont = [UIFont boldSystemFontOfSize:17];
    // 输入框距离键盘的距离
    keyboardManager.keyboardDistanceFromTextField = 10.0f;
}

- (void)applicationWillResignActive:(UIApplication *)application {
    
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
    
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
    
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
    
}


- (void)applicationWillTerminate:(UIApplication *)application {
    
}


@end
